//
//  RTJCancelAutoMarkView.m
//  RuiTaiJinProject
//
//  Created by jayson on 2019/2/25.
//  Copyright © 2019年 leewei. All rights reserved.
//

#import "RTJCancelAutoMarkView.h"
#import "LewPopupViewController.h"
#import "RTJForgetPassWordController.h"

@interface RTJCancelAutoMarkView()<UITextFieldDelegate,ZXRegTextFieldDelegate>



@end

@implementation RTJCancelAutoMarkView

+ (instancetype)defaultViewWithFrame:(CGRect)rect title:(NSString *)title{
    
    return [[RTJCancelAutoMarkView alloc]initWithFrame:rect title:title];
    
}

- (id)initWithFrame:(CGRect)frame title:(NSString *)title
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [[NSBundle mainBundle] loadNibNamed:[[self class] description] owner:self options:nil];
        
        _autoMarkView.frame = frame;
        [self addSubview:_autoMarkView];
        
        _autoMarkView.layer.masksToBounds = YES;
        _autoMarkView.layer.cornerRadius = 9;
        
        _tipsLab.text = [NSString stringWithFormat:@"确认撤销“%@”的出借？撤销后撤销的投资金额将解除冻结状态，返还到可用金额。",title];
        _pswFld.layer.cornerRadius = _pswFld.height/2;
        _pswFld.layer.masksToBounds = YES;
        _pswFld.layer.borderColor = [UIColor colorForHex:@"#E6E6E6"].CGColor;
        _pswFld.layer.borderWidth = 1;
        
        _pswFld.delegate = self;
        _pswFld.zxdelegate = self;
        _pswFld.zxType = ZXRegTextFieldTypeChars;
        _pswFld.secureTextEntry = YES;

        
    }
    return self;
}

- (IBAction)sureBtn:(id)sender {

    if (self.sureClick) {
        
        self.sureClick(_pswFld.text);
    }
    
    [_parentVC lew_dismissPopupView];
}

- (IBAction)cancelBtn:(id)sender {
    
    [_parentVC lew_dismissPopupView];

}

- (IBAction)forgetPsw:(id)sender {
    
    [_parentVC lew_dismissPopupView];

    RTJForgetPassWordController *vc = [[RTJForgetPassWordController alloc]init];
    vc.isPayPassWord = YES;
    vc.title = @"找回支付密码";
    [_parentVC.navigationController pushViewController:vc animated:YES];
}

-(void)withSureClick:(SureCancelBlock)block{
    
    _sureClick = block;
}

@end
